package com.dkm.ec.product.persistence.dao.impl;

import java.util.List;

import org.springframework.stereotype.Repository;

import com.dkm.base.db.mybatis.dao.MyBatisQueryDaoImpl;
import com.dkm.ec.product.persistence.dao.ProductMediaQueryDao;
import com.dkm.ec.product.persistence.entity.ProductMediaPo;

/**
 * 对象功能:产品媒体 QueryDao接口的实现
 * 开发公司:SKG.COM
 * 开发人员:颜超敏
 * 创建时间:2014-12-17 17:21:14
 */
@Repository
public class ProductMediaQueryDaoImpl extends MyBatisQueryDaoImpl<String, ProductMediaPo> implements ProductMediaQueryDao{

    @Override
    public String getNamespace() {
        return ProductMediaPo.class.getName();
    }

//	@Override
	public List<ProductMediaPo> findByProdId(String prodId) {
		return findByKey("findByProdId", b().a("prodId", prodId).p());
	}
	
	public List<ProductMediaPo> findSaleByProdId(String prodId) {
		return findByKey("findSaleByProdId", b().a("prodId", prodId).p());
	}
	

	@Override
	public ProductMediaPo getMainMediaPoByProdId(String prodId) {
		return getByKey("getMainMediaPoByProdId", b().a("prodId", prodId).p());
	}

	@Override
	public ProductMediaPo getMainMediaPoByProdIdAttrOpId(String prodId,
			String attrOpId) {
		return getByKey("getMainMediaPoByProdIdAttrOpId", b().a("prodId", prodId).a("attrOpId", attrOpId).p());
	}

	
	@Override
	public ProductMediaPo getSpecialMediaPoByProdId(String prodId) {
		return getByKey("getSpecialMediaPoByProdId", b().a("prodId", prodId).p());
	}

	@Override
	public ProductMediaPo getSpecialMediaPoByProdIdAttrOpId(String prodId,
			String attrOpId) {
		return getByKey("getSpecialMediaPoByProdIdAttrOpId", b().a("prodId", prodId).a("attrOpId", attrOpId).p());
	}
	
	
	@Override
	public List<ProductMediaPo> findByProdIdForSale(String prodId,String isGallery,String mediaType,String attrOpId) {
		return findByKey("findByProdIdForSale", b().a("prodId", prodId).a("isGallery", isGallery).a("mediaType", mediaType).a("attrOpId",attrOpId).p());
	}

	@Override
	public List<ProductMediaPo> findSpecialMediaPoByProdIdAttrOpId(
			String prodId, String attrOpId) {
		return findByKey("findSpecialMediaPoByProdIdAttrOpId", b().a("prodId", prodId).a("attrOpId", attrOpId).p());
	}

	@Override
	public List<ProductMediaPo> findSpecialMediaPoByProdId(String prodId) {
		return findByKey("findSpecialMediaPoByProdId", b().a("prodId", prodId).p());
	}
	
}
